#include<iostream>
#include<string>
#include<map>
using namespace std;
typedef long long LL;
int n;
string s;
map<char, int>mp;
int main()
{
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		mp[s[i]]++;
	}
	string ans1, ans2;
	bool flag = 0;
	for (int i = 9; i >= 0; i--) {
		char c = i + '0';
		while (mp[c]) {
			if (!flag) {
				ans1 += c;
				mp[c]--;
				flag = 1;
			}
			else {
				ans2 += c;
				mp[c]--;
				flag = 0;
			}
		}
	}
	int cnt1 = 0, cnt2 = 0;
	for (int i = 0; i < ans1.size(); i++) cnt1 += (ans1[i] == '0');
	for (int i = 0; i < ans2.size(); i++) cnt2 += (ans2[i] == '0');
	if (cnt1 == ans1.size())cout << "0" << endl;
	else cout << ans1 << endl;
	if (cnt2 == ans2.size())cout << "0" << endl;
	else cout << ans2 << endl;
	return 0;
}